#pragma once
#include "vec3.h"
#include "Math/Random.h"

class ray
{
public:
	ray() {}
	ray(const vec3& a, const vec3& b) { A = a; B = b; }
	vec3 origin() const { return A; }
	vec3 direction() const { return B; }
	vec3 point_at_parameter(float t) const { return A + t * B; }

	vec3 A;
	vec3 B;
};

vec3 random_in_unit_sphere()
{
	vec3 p = 2.0f * vec3(Random::Value(), Random::Value(), Random::Value()) - vec3(1, 1, 1);
	p.make_unit_vector();
	p = p * Random::Value();
	return p;
}

vec3 reflect(const vec3& v, const vec3& n) {
	return v - 2 * dot(v, n) * n;
}